//
//  ViewController.m
//  SLPhotoBrowser
//
//  Created by S_LINE on 2020/6/21.
//  Copyright © 2020 S_LINE. All rights reserved.
//

#import "ViewController.h"

#import "SLPhotoBrowserManager.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupView];
}

- (void)setupView
{
    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(15, 100, 80, 40)];
    button.backgroundColor = [UIColor redColor];
    [button setTitle:@"测试" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
}

- (void)buttonClick
{
    NSArray *imageUrls = @[
        @"https://img9.doubanio.com/view/photo/l_ratio_poster/public/p2871026266.jpg",
        @"https://lookimg.com/images/2020/06/18/PA5HyR.jpg",
        @"https://img9.doubanio.com/view/photo/l_ratio_poster/public/p2784513117.jpg"
    ];
    NSMutableArray<SLPhotoModel *> *images = [[NSMutableArray alloc] init];
    for (int i = 0; i < imageUrls.count; i++) {
        SLPhotoModel *model = [[SLPhotoModel alloc] init];
        model.imageUrl = imageUrls[i];
        [images addObject:model];
    }
    [[SLPhotoBrowserManager defaultManager] photoBrowserWithImages:images currentIndex:1 removeable:YES removeCallback:^(NSInteger index) {
        
    }];
}

@end
